A very conservative move of xml_tag into a class of its own with
authorrobertlipe <robertlipe@f51c46e8-681c-474f-0cfe-069cfd0219fb>
Fri, 6 Sep 2013 19:15:28 +0000 (19:15 +0000)
committerrobertlipe <robertlipe@f51c46e8-681c-474f-0cfe-069cfd0219fb>
Fri, 6 Sep 2013 19:15:28 +0000 (19:15 +0000)
headers of its own. Tweak xmalloc/xfree to new/delete.   Regenerate deps.

gpsbabel/Makefile.in
gpsbabel/defs.h
gpsbabel/delbin.cc
gpsbabel/gpx.cc
gpsbabel/html.cc
gpsbabel/kml.cc
gpsbabel/src/core/xmltag.h [new file with mode: 0644]
gpsbabel/text.cc
gpsbabel/util.cc
gpsbabel/xmltag.cc

index 6df5af759ba55cf029f19eed20b951d2bc5d675a..9d95cf925f13a285e12cd1814fde7fa74d6db649 100644 (file)
@@ -469,7 +469,8 @@ csv_util.o: csv_util.cc defs.h config.h queue.h zlib/zlib.h zlib/zconf.h \
   jeeps/gpsrqst.h jeeps/gpsinput.h jeeps/gpsproj.h garmin_fs.h \
   jeeps/gps.h xcsv_tokens.gperf
 delbin.o: delbin.cc defs.h config.h queue.h zlib/zlib.h zlib/zconf.h \
-  gbfile.h cet.h cet_util.h inifile.h session.h src/core/datetime.h
+  gbfile.h cet.h cet_util.h inifile.h session.h src/core/datetime.h \
+  src/core/xmltag.h
 delgpl.o: delgpl.cc defs.h config.h queue.h zlib/zlib.h zlib/zconf.h \
   gbfile.h cet.h cet_util.h inifile.h session.h src/core/datetime.h
 destinator.o: destinator.cc defs.h config.h queue.h zlib/zlib.h \
@@ -631,7 +632,8 @@ gpx.o: gpx.cc defs.h config.h queue.h zlib/zlib.h zlib/zconf.h gbfile.h \
   jeeps/gps.h jeeps/gpssend.h jeeps/gpsread.h jeeps/gpsutil.h \
   jeeps/gpsapp.h jeeps/gpsprot.h jeeps/gpscom.h jeeps/gpsfmt.h \
   jeeps/gpsmath.h jeeps/gpsmem.h jeeps/gpsrqst.h jeeps/gpsinput.h \
-  jeeps/gpsproj.h src/core/file.h defs.h src/core/xmlstreamwriter.h
+  jeeps/gpsproj.h src/core/file.h defs.h src/core/xmlstreamwriter.h \
+  src/core/xmltag.h
 grtcirc.o: grtcirc.cc defs.h config.h queue.h zlib/zlib.h zlib/zconf.h \
   gbfile.h cet.h cet_util.h inifile.h session.h src/core/datetime.h \
   grtcirc.h
@@ -660,7 +662,7 @@ html.o: html.cc defs.h config.h queue.h zlib/zlib.h zlib/zconf.h gbfile.h \
   jeeps/gpsdevice.h jeeps/gpssend.h jeeps/gpsread.h jeeps/gpsutil.h \
   jeeps/gpsapp.h jeeps/gpsprot.h jeeps/gpscom.h jeeps/gpsfmt.h \
   jeeps/gpsmath.h jeeps/gpsmem.h jeeps/gpsrqst.h jeeps/gpsinput.h \
-  jeeps/gpsproj.h
+  jeeps/gpsproj.h src/core/xmltag.h
 humminbird.o: humminbird.cc defs.h config.h queue.h zlib/zlib.h \
   zlib/zconf.h gbfile.h cet.h cet_util.h inifile.h session.h \
   src/core/datetime.h
@@ -844,7 +846,8 @@ jtr.o: jtr.cc defs.h config.h queue.h zlib/zlib.h zlib/zconf.h gbfile.h \
   cet.h cet_util.h inifile.h session.h src/core/datetime.h csv_util.h
 kml.o: kml.cc defs.h config.h queue.h zlib/zlib.h zlib/zconf.h gbfile.h \
   cet.h cet_util.h inifile.h session.h src/core/datetime.h xmlgeneric.h \
-  grtcirc.h src/core/file.h defs.h src/core/xmlstreamwriter.h
+  grtcirc.h src/core/file.h defs.h src/core/xmlstreamwriter.h \
+  src/core/xmltag.h
 lmx.o: lmx.cc defs.h config.h queue.h zlib/zlib.h zlib/zconf.h gbfile.h \
   cet.h cet_util.h inifile.h session.h src/core/datetime.h xmlgeneric.h
 lowranceusr.o: lowranceusr.cc defs.h config.h queue.h zlib/zlib.h \
@@ -1051,7 +1054,7 @@ text.o: text.cc defs.h config.h queue.h zlib/zlib.h zlib/zconf.h gbfile.h \
   jeeps/gpsdevice.h jeeps/gpssend.h jeeps/gpsread.h jeeps/gpsutil.h \
   jeeps/gpsapp.h jeeps/gpsprot.h jeeps/gpscom.h jeeps/gpsfmt.h \
   jeeps/gpsmath.h jeeps/gpsmem.h jeeps/gpsrqst.h jeeps/gpsinput.h \
-  jeeps/gpsproj.h
+  jeeps/gpsproj.h src/core/xmltag.h
 tiger.o: tiger.cc defs.h config.h queue.h zlib/zlib.h zlib/zconf.h \
   gbfile.h cet.h cet_util.h inifile.h session.h src/core/datetime.h \
   csv_util.h
@@ -1091,14 +1094,17 @@ units.o: units.cc defs.h config.h queue.h zlib/zlib.h zlib/zconf.h \
   gbfile.h cet.h cet_util.h inifile.h session.h src/core/datetime.h
 util.o: util.cc defs.h config.h queue.h zlib/zlib.h zlib/zconf.h gbfile.h \
   cet.h cet_util.h inifile.h session.h src/core/datetime.h \
-  jeeps/gpsmath.h jeeps/gps.h jeeps/../defs.h jeeps/gpsport.h \
-  jeeps/gpsdevice.h jeeps/gpssend.h jeeps/gpsread.h jeeps/gpsutil.h \
-  jeeps/gpsapp.h jeeps/gpsprot.h jeeps/gpscom.h jeeps/gpsfmt.h \
-  jeeps/gpsmath.h jeeps/gpsmem.h jeeps/gpsrqst.h jeeps/gpsinput.h \
-  jeeps/gpsproj.h
+  src/core/xmltag.h jeeps/gpsmath.h jeeps/gps.h jeeps/../defs.h \
+  jeeps/gpsport.h jeeps/gpsdevice.h jeeps/gpssend.h jeeps/gpsread.h \
+  jeeps/gpsutil.h jeeps/gpsapp.h jeeps/gpsprot.h jeeps/gpscom.h \
+  jeeps/gpsfmt.h jeeps/gpsmath.h jeeps/gpsmem.h jeeps/gpsrqst.h \
+  jeeps/gpsinput.h jeeps/gpsproj.h
 util_crc.o: util_crc.cc
 v900.o: v900.cc defs.h config.h queue.h zlib/zlib.h zlib/zconf.h gbfile.h \
   cet.h cet_util.h inifile.h session.h src/core/datetime.h
+validate.o: validate.cc defs.h config.h queue.h zlib/zlib.h zlib/zconf.h \
+  gbfile.h cet.h cet_util.h inifile.h session.h src/core/datetime.h \
+  filterdefs.h
 vcf.o: vcf.cc defs.h config.h queue.h zlib/zlib.h zlib/zconf.h gbfile.h \
   cet.h cet_util.h inifile.h session.h src/core/datetime.h \
   jeeps/gpsmath.h jeeps/gps.h jeeps/../defs.h jeeps/gpsport.h \
@@ -1146,7 +1152,8 @@ xmlgeneric.o: xmlgeneric.cc defs.h config.h queue.h zlib/zlib.h \
   zlib/zconf.h gbfile.h cet.h cet_util.h inifile.h session.h \
   src/core/datetime.h xmlgeneric.h src/core/file.h defs.h
 xmltag.o: xmltag.cc defs.h config.h queue.h zlib/zlib.h zlib/zconf.h \
-  gbfile.h cet.h cet_util.h inifile.h session.h src/core/datetime.h
+  gbfile.h cet.h cet_util.h inifile.h session.h src/core/datetime.h \
+  src/core/xmltag.h
 xol.o: xol.cc defs.h config.h queue.h zlib/zlib.h zlib/zconf.h gbfile.h \
   cet.h cet_util.h inifile.h session.h src/core/datetime.h xmlgeneric.h \
   jeeps/gpsmath.h jeeps/gps.h jeeps/../defs.h jeeps/gpsport.h \
index 60a841aa2ffbe36d13f7ef7fbe9d0dfc602c2399..d17311e0e7ecd7e315b8a57237208e6d75b511bb 100644 (file)
@@ -305,18 +305,6 @@ public:
   QString personal_note;
 };
 
-typedef struct xml_tag {
-  char* tagname;
-  char* cdata;
-  int cdatalen;
-  char* parentcdata;
-  int parentcdatalen;
-  char** attributes;
-  struct xml_tag* parent;
-  struct xml_tag* sibling;
-  struct xml_tag* child;
-} xml_tag ;
-
 typedef void (*fs_destroy)(void*);
 typedef void (*fs_copy)(void**, void*);
 typedef void (*fs_convert)(void*);
@@ -346,13 +334,6 @@ void fs_chain_destroy(format_specific_data* chain);
 format_specific_data* fs_chain_find(format_specific_data* chain, long type);
 void fs_chain_add(format_specific_data** chain, format_specific_data* data);
 
-typedef struct fs_xml {
-  format_specific_data fs;
-  xml_tag* tag;
-} fs_xml;
-
-fs_xml* fs_xml_alloc(long type);
-
 #define FS_GPX 0x67707800L
 #define FS_AN1W 0x616e3177L
 #define FS_AN1L 0x616e316cL
@@ -701,7 +682,6 @@ unsigned int waypt_count(void);
 void set_waypt_count(unsigned int nc);
 void waypt_add_url(waypoint* wpt, const QString& link,
                    const QString& url_link_text);
-void free_gpx_extras(xml_tag* tag);
 void xcsv_setup_internal_style(const char* style_buf);
 void xcsv_read_internal_style(const char* style_buf);
 waypoint* find_waypt_by_name(const char* name);
@@ -1034,10 +1014,6 @@ const char* get_filename(const char* fname);                     /* extract the filename portion *
 /* this lives in gpx.c */
 gpsbabel::DateTime xml_parse_time(const QString& cdatastr);
 
-xml_tag* xml_findfirst(xml_tag* root, const char* tagname);
-xml_tag* xml_findnext(xml_tag* root, xml_tag* cur, const char* tagname);
-char* xml_attribute(xml_tag* tag, const char* attrname);
-
 char* rot13(const QString& str);
 
 /*
index 18fccc6946fc96f9506b0254e00ff67f903d37a6..4a4db13ac00bc7d2b96f2e40d2764971f23d75b6 100644 (file)
@@ -21,6 +21,8 @@
  */
 
 #include "defs.h"
+#include "src/core/xmltag.h"
+
 #include <assert.h>
 
 #define MYNAME "delbin"
index 297554e572c1726354a1c7c549dea14909a4b4b7..bb472e51520623faad3dce142eab48147d0805fa 100644 (file)
@@ -27,6 +27,8 @@
 static QXmlStreamReader* reader;
 #include "src/core/file.h"
 #include "src/core/xmlstreamwriter.h"
+#include "src/core/xmltag.h"
+
 #include <QtCore/QRegExp>
 #include <QtCore/QDateTime>
 #include <QtCore/QDebug>
@@ -548,7 +550,7 @@ start_something_else(const QString el, const QXmlStreamAttributes& attr)
     return;
   }
 
-  new_tag = (xml_tag*)xcalloc(sizeof(xml_tag),1);
+  new_tag = new xml_tag;
   new_tag->tagname = xstrdup(CSTR(el));
 
   attr_count = attr.size();
index 12c4d65f1bf2a0ff90ed225d4fa550f7a5b6ac77..0e3b894cc578b0de3a04ebc4bd105b90b264ff48 100644 (file)
@@ -22,6 +22,7 @@
 
 #include "defs.h"
 #include "jeeps/gpsmath.h"
+#include "src/core/xmltag.h"
 #include <ctype.h>
 
 static gbfile* file_out;
index 3aa5cf5d552965f35c06ed2d2c61aa21eeb7b93e..005f5309bdb671c7ee1ce9a3a348abd72e294455 100644 (file)
@@ -34,6 +34,7 @@
 
 #include "src/core/file.h"
 #include "src/core/xmlstreamwriter.h"
+#include "src/core/xmltag.h"
 
 // options
 static char* opt_deficon = NULL;
diff --git a/gpsbabel/src/core/xmltag.h b/gpsbabel/src/core/xmltag.h
new file mode 100644 (file)
index 0000000..eba34eb
--- /dev/null
@@ -0,0 +1,53 @@
+/*
+    Copyright (C) 2002-2013 Robert Lipe, gpsbabel.org
+
+    This program is free software; you can redistribute it and/or modify
+    it under the terms of the GNU General Public License as published by
+    the Free Software Foundation; either version 2 of the License, or
+    (at your option) any later version.
+
+    This program is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+    GNU General Public License for more details.
+
+    You should have received a copy of the GNU General Public License
+    along with this program; if not, write to the Free Software
+    Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111 USA
+
+ */
+class xml_tag {
+ public:
+  xml_tag() :
+    tagname(NULL),
+    cdata(NULL),
+    cdatalen(0),
+    parentcdata(NULL),
+    parentcdatalen(0),
+    attributes(NULL),
+    parent(NULL),
+    sibling(NULL),
+    child(NULL) {}
+
+  char* tagname;
+  char* cdata;
+  int cdatalen;
+  char* parentcdata;
+  int parentcdatalen;
+  char** attributes;
+  struct xml_tag* parent;
+  struct xml_tag* sibling;
+  struct xml_tag* child;
+};
+
+xml_tag* xml_findfirst(xml_tag* root, const char* tagname);
+xml_tag* xml_findnext(xml_tag* root, xml_tag* cur, const char* tagname);
+char* xml_attribute(xml_tag* tag, const char* attrname);
+void free_gpx_extras(xml_tag* tag);
+
+typedef struct fs_xml {
+  format_specific_data fs;
+  xml_tag* tag;
+} fs_xml;
+
+fs_xml* fs_xml_alloc(long type);
index 80f2910db659a58f702811a56233f97e6a204cdb..0b419b75abf608a44ec18fd97dd04a3720174c9c 100644 (file)
@@ -22,6 +22,7 @@
 
 #include "defs.h"
 #include "jeeps/gpsmath.h"
+#include "src/core/xmltag.h"
 #include <ctype.h>
 
 static gbfile* file_out;
index a02b9498d74e0175ac64230460937d234465aaa6..4d9aa91365f3972c726b46280f2f28aea33e0df2 100644 (file)
@@ -20,6 +20,7 @@
  */
 
 #include "defs.h"
+#include "src/core/xmltag.h"
 #include "jeeps/gpsmath.h"
 
 #include <ctype.h>
index 8234aa539568440cd8691960358633f5a6e6431b..810710b60b795f315e644b843d3e1dae23053290 100644 (file)
@@ -24,6 +24,7 @@
 #include <string.h>
 
 #include "defs.h"
+#include "src/core/xmltag.h"
 
 static void
 free_xml_tag(xml_tag* tag)
@@ -55,7 +56,7 @@ free_xml_tag(xml_tag* tag)
     }
 
     next = tag->sibling;
-    xfree(tag);
+    delete tag;
     tag = next;
   }
 }